package com.wsy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wsy.entity.BookInfo;
import com.wsy.entity.Orders;
import com.wsy.mapper.BookInfoMapper;
import com.wsy.service.BookInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookInfoImpl extends ServiceImpl<BookInfoMapper, BookInfo> implements BookInfoService {
    @Resource
    BookInfoMapper bookInfoMapper;

    @Override
    public PageInfo<BookInfo> select(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return new PageInfo<>(bookInfoMapper.select());
    }

    @Override
    public List<BookInfo> selectById(Integer id) {
        return bookInfoMapper.selectById(id);
    }

    @Override
    public int addOrders(Orders orders) {
        return bookInfoMapper.addOrders(orders);
    }

    @Override
    public List<Orders> selOrders(String oid) {
        return bookInfoMapper.selOrders(oid);
    }

    @Override
    public int updOrderPay(String oid, String addressId) {
        return bookInfoMapper.updOrderPay(oid, addressId);
    }

    @Override
    public List<Orders> selUserOrders(String userId){
        return bookInfoMapper.selUserOrders(userId);
    }
}
